<?php
session_start();
include("../../includes/dbInfo.php");
// Event id comes from the ajax call.
$commentID = $_POST["commentID"];

// Get the coach comment from the ls_comments table and 
// get the coaches name from the accounts table given the commentID.
$query = "SELECT `ls_comments`.`comment` AS comment, `ls_comments`.`timeStamp` AS postDate,
		`accounts`.`name` AS name
		FROM `ls_comments`, `accounts`
		WHERE `ls_comments`.`commentID` = '$commentID'";
$resource = mysql_query($query) or die(mysql_error());
						
$rows = mysql_fetch_assoc($resource);
// Show a message if there are no comments
if(is_null($rows["comment"])) {
	echo "no comments";
}
else {
	// Return the coaches name and the comment to the ajax call.
	echo "<p>From: " . $rows["name"] . "<br/>Posted: " . $rows["postDate"] . "</p><p>" . $rows["comment"] . "</p>";
}
?>